package org.performance.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/record")
public class DataRender {

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public @ResponseBody
	Object[][] list(HttpServletRequest request, HttpServletResponse response) {
		Object[][] data = { { "Year", "Sales", "Expenses" },
				{ "2004", 1000, 400 }, { "2005", 1170, 460 },
				{ "2006", 660, 1120 }, { "2007", 1030, 540 } };
		return data;
	}

	@RequestMapping(method = RequestMethod.GET)
	public @ResponseBody
	Object[][] index(HttpServletRequest request, HttpServletResponse response) {
		System.out.println("index");
		return list(request, response);
	}
}
